chdkfandomcom-20200222-history
FAQ/Mac
Mac user seem to have a particularly frustrating time trying to figure out how to get CHDK onto an SD card as well as copying scripts correctly so they won't get parse and UNK errors with every one they try to run. Below are some tips and hints for Mac users. ---- How to Install CHDK on a SD Card using a Macintosh OS X 10.5 "Leopard" In Brief #Download the appropriate autobuild. #Format your SD card, or partition as FAT16. #Install CHDK. #Lock card. #Run CHDK. ------------------------ Software needed: *Disk Utility (comes standard on every Mac) *Terminal (comes standard with OSX) *0xED (or another hex editor) ::Either 0xED (free), or Hex Fiend (free), will work. Hardware needed: *Canon camera *memory card *card reader Find the Right Autobuild The first requirement is to identify the exact firmware revision of the destination camera. *Insert a memory card into a card reader attached to your Mac. *Using a basic text editor (TextEdit), make an empty file called ver.req in the root of the SD card. *Boot the camera in playback mode, with the card inserted. *While holding the Function/Set button, press Display. ::The camera's firmware version is the last four digits 1.01B of the line reading: "Firmware Ver GM1.01B" For more detailed instructions, go here. Build names include references to camera models and firmware versions. For example, a build name that includes the text "...A610 fw v1.00e" is designed for the A610 camera with firmware version v1.00e. (Note that cameras sold outside the United States often have different model designations. See the table at "For Developers" for cross-reference.) Autobuilds usually include the vers.req file needed for determining your firmware version. (Of course, without knowing your firmware version, you won't know which autobuild to have selected in the first place.) In lieu of determining your camera's firmware version, you can try installing every build available for your camera's model. Some have only one to try. If this is unsuccessful and you seek help, please determine your camera's firmware version before posting a request for assistance. You'll actually see two versions of CHDK for each camera model. The "Complete" build includes files such as fonts, grids, scripts and languages. The "Small" build contains only the binary source code. Complete builds change less frequently than small builds, so please don't overuse our bandwidth by downloading complete builds multiple times a day. *Download the appropriate build from Autobuild Downloads. What if nothing is available for my camera? Head to the "For Developers" page to see what progress is being made in porting CHDK to additional cameras and firmware versions. And perhaps you can help! Install CHDK Two methods are presented. The first is for installation on memory cards that are 4GB or smaller. The second method is for installation on cards that are larger than 4GB. SD Card ≤4GB CHDK requires a card formatted with the FAT16 file system, which is limited to a maximum of 4 GB, to load properly on camera startup. *Insert an unlocked memory card into a card reader connected to your Mac. *Open Disk Utility. *Select the card reader from the list of devices on the left. *Get Info ( Apple+I ), and note the Disk Identifier, ie.( /dev/disk2s1 ). This identifier is very important; it will be used to address the proper disk for all subsequent steps. :We will refer to the disk identifier as '/dev/diskX''' from now on.'' *Be sure that the disk is currently formatted as FAT32 or another MSDOS format. If it is already formatted as FAT16, skip the next steps. *Unmount the partition. Do not eject. *Open the Terminal *type: sudo newfs_msdos -F 16 -v SD870IS -b 4096 -c 128 /dev/diskX This will reformat a FAT32 disk as FAT16, thus making it compatible with CHDK. *enter your password when prompted *Type: dd if=/dev/diskX of=BootSector_G9.bin bs=512 count=1 This copies a sector of the SD card to your Mac's hard disk. *Make a backup of the BootSector_G9.bin file, that has been created in your Home directory, in case anything goes wrong. The BootSector_G9.bin file contains your SD card's boot sector. *Open BootSector_G9.bin with 0xED. :Keep in mind that, if you do not see FAT12 or FAT16 around 0x36 (decimal 54) in the hex editor, you probably picked the wrong drive. '''Do not overwrite anything in that case.' *If the file is correct, select the Overwrite writing method ('Command+Shift+O'). *Go to offset hex 40 (decimal 64) and press Tab. Type '''BOOTDISK'. Save and quit. *In your Terminal window, type: dd if=BootSector_G9.bin of=/dev/diskX bs=512 count=1 This copies the modified file to the boot sector of your SD card. *Using Disk Utility, mount the card. *Copy the file DISKBOOT.BIN to your SD card. Make sure to use the correct version for your model of Canon camera. *Copy ver.req to the card. (This is optional, but guarantees full CHDK functionality.) *Copy the CHDK folder to the card. (This is optional, but guarantees full CHDK functionality.) *Eject the SD card. *Slide the tab to the LOCK position. :It is necessary to LOCK the SD card to load the CHDK software. With the card locked and the camera running CHDK, you are still able to record pictures on the card. SD Card >4GB If you have a card larger than 4 GB, the solution is to create two partitions on your card: a small FAT16 partition, and a larger FAT32 partition. (The FAT16 partition can be very small, like 2 MB, and must be the first partition on the card.) You would then install the CHDK boot files (DISKBOOT.BIN and possibly PS.FIR) on the FAT16 partition, and everything else on the FAT32 one. When using this system, CHDK will start from the FAT16 part of the card. It will then automatically detect the larger FAT32 partition, and "switch over" to use that one. All images, movies, etc. will be stored on the large partition, and all CHDK scripts and data files will be read from there. (The smaller partition cannot be accessed once CHDK is loaded, so don't put any scripts or other files on it that you want to use!) *Insert an unlocked memory card into a card reader connected to your Mac. *Open Disk Utility. *Select the card reader from the list of devices on the left. *Click the "Partition" tab in the right pane. *Select and resize the first partition to 4MB. Format it as MS-DOS. *Select the second partition and format it as MS-DOS. The size will be set automatically. *Click "Apply". *Select the first partition from the list on the left. *Get Info ( Apple+I ), and note the Disk Identifier, ie.( /dev/disk2s1 ). This identifier is very important; it will be used to address the proper disk for all subsequent steps. :We will refer to the disk identifier as /dev/diskX from now on. *Unmount the partition. Do not eject. *Open the Terminal *type: fdisk -e /dev/diskX ie.( fdisk -e /dev/disk2s1 ) *type: setpid 1 *enter 1''' when prompted for new partition id *type: '''write *type: exit :For more information on using fdisk see, ManPages/fdisk *Type: dd if=/dev/diskX of=BootSector_G9.bin bs=512 count=1 This copies a sector of the SD card to your Mac's hard disk. *Make a backup of the BootSector_G9.bin file, that has been created in your Home directory, in case anything goes wrong. ::The BootSector_G9.bin file contains your SD card's boot sector. *Open BootSector_G9.bin with 0xED. :Keep in mind that, if you do not see FAT12 or FAT16 around 0x36 (decimal 54) in the hex editor, you probably picked the wrong drive. '''Do not overwrite anything in that case.' *If the file is correct, select the Overwrite writing method ('Command+Shift+O'). *Go to offset hex 40 (decimal 64) and press '''Tab'. *Type BOOTDISK. Save and quit. *In your Terminal window, type: dd if=BootSector_G9.bin of=/dev/diskX bs=512 count=1 This copies the modified file to the boot sector of your SD card. *Using Disk Utility, mount the card. *Copy the file DISKBOOT.BIN to the first partition of your SD card. Make sure to use the correct version for your model of Canon camera. *Copy ver.req to the second partition. (This is optional, but guarantees full CHDK functionality.) *Copy the CHDK folder to the second partition. (This is optional, but guarantees full CHDK functionality.) *Eject the SD card. *Slide the tab to the LOCK position. :It is necessary to LOCK the SD card to load the CHDK software. With the card locked and the camera running CHDK, you are still able to record pictures on the card. You now have a Bootable SD card with two partitions with CHDK properly installed. The camera will now attempt to load the DISKBOOT.BIN file whenever the camera is started with that SD card (when it's locked). Note: unlocking the SD card will disable CHDK, and subsequently give the camera access to only the first partition. Thus you will be unable to record any images. ----------------------- Using CHDK Now that CHDK is properly installed on your Canon camera. It is time to learn how to use it at: CHDK Usage ----------------------- Still Having Trouble? You may have issues with permissions. Short Answer The system Archive Utility by default does not make downloadable files executable as a security feature. In order to get the CHDK firmware files on to an SD card from a Mac, either the files need to be decompressed with an application called The Unarchiver or Untar or StuffIt (commercial app with free unarchiver) and not the system Archive Utility, or you can make the files executable using the command line. Long Answer The system's Archive Utility adds a flag to the file. The files uncompressed from Archive Utility have an "@" at the end of the permissions string when viewed in Terminal via the command "ls -la". Here are the results I got, once I copied the files to the SD card: ---- Point of note: @ means there's an ACL associated with that file. Removing the ACL through whatever means (the later method included) should be fine. That would appear to be the only real "problem", and as of 10.5.4 it doesn't appear to add an ACL to it anymore anyway. ---- From Archive Utility: -rwxrwxrwx@ 1 127664 10 Dec 02:17 DISKBOOT.BIN -rwxrwxrwx@ 1 128412 10 Dec 02:17 PS.FIR The @ indicates an extended attribute. Using ls -la@ will show -rwxrwxrwx@ 1 127664 10 Dec 02:17 DISKBOOT.BIN com.apple.quarantine 38 -rwxrwxrwx@ 1 128412 10 Dec 02:17 PS.FIR com.apple.quarantine 38 NOPE: Instructions don't work. Attached my "supported' SD800IS via the cable to my Leopard/MacBook with the provided cable. Photo Download APP boots, but no reference to /Volumes/Canon of any kind. What steps are missing in the instructions? With a BS in Comp Sci I can't figure it out. These instructions are simply broken. Don't bother. ----- Previous poster should understand that most Canon cameras don't mount themselves as USB mass storage devices, therefore when you connect the camera to a computer it will not show up as a drive. You need to connect the SD card to your computer using a card reader; the card will appear in your /Volumes and on the left side of Finders. The instructions DO work. Now back to the normal show... ------ The com.apple.quarantine flag indicates that Apples quarantine system is flagging this file as downloaded from the internet, which normally means it won't be executed unless the user specifically allows it, a security feature added in Mac OS X 10.5. I'm not quite sure how this is implemented, or why the camera respects this flag, but it appears to be the problem. These flags can be removed by opening the Terminal (in your Applications > Utilities folder) and using the commands cd /Volumes/CANON_DC xattr -d com.apple.quarantine DISKBOOT.BIN PS.FIR Note that if you have renamed your card from 'CANON_DC' you should make the obvious change above. :-) Alternatively, use an unarchiver that does not flag the files as quarantined. From The Unarchiver: -rwxrwxrwx 1 127664 10 Dec 02:17 DISKBOOT.BIN -rwxrwxrwx 1 128412 10 Dec 02:17 PS.FIR Hypothetically any zip decompressing application that doesn't add the "@" flag, should be able to unzip it fine and work when coped to the SD. I should point out that Windows XP doesn't add the "@" flag either. ---- How to Copy Script Files Without Errors This method uses the system text editor, TextEdit. The file has to be plain text and encoded as UTF-8 to work. Technically any editor can do it as long as it produces a plain text file with UTF-8 encoding, but the steps below use TextEdit. *NOTE: a sure fire way to know you have errant characters in your file is that the camera will give you a "parse error" immediately when you try to run the script. Like if you forgot to format the file as "plain text" on a mac. Or used Linux and forgot that Linux uses a linefeed as an end of line character instead of a carriage return. Steps # Open TextEdit # Format -> Make Plain Text # Copy in code / Write your own code # File -> Save As... # Enter a name for the script with the ".bas" extension # For Plain Text Encoding, select "Unicode (UTF-8)" # Copy the saved script to the SD card # Done!* Alternative Terminal Method # Open terminal and navigate to /Canon_DC/CHDK/SCRIPTS # create a file with pico - type "pico filename" # type - print "hello world" # hit control-x to exit # hit "y" to save Now you should be able to edit the file with TextEdit or BBEdit without trouble. Terminal Method using Leopard # Open terminal located in Applications > Utilities > Terminal # Copy the version of allbest you wish to run onto your memory card "cp ~/Downloads/allbest-ixus70_sd1000-101b-50.zip /Volumes/CANON_DC" - change CANON_DC to whatever your memory card shows as on your desktop # Change to the card directory "cd /Volumes/CANON_DC" # Unzip the file "unzip allbest-ixus70_sd1000-101b-50.zip" # Exit the terminal "exit" ---- *Note: If you see files entitled "._Name.bas", be warned, they are NOT scripts! They are invisible files placed there by OS X, and nothing will happen if you try to run them as scripts. You might be able to delete them without adverse effects in the camera's file browser. The script you're looking for is below these files, in alphabetical order. *NOTE2: Those are called resource forks and have existed on the Mac forever. They contain information that associates the file with applications, creator info, etc. On the mac they don't normally even show up, but beware since the camera has no idea what to do with them and you should ONLY copy the original file name, but leave the _(Script Name).bas there so that you can edit the file(s) later again on your mac. Thankyou: VeryGreen, and the folks at InsanelyMac, and of course, everyone at CHDK. Category:Help